#include "XiaoxiMessage.h"
#include "SocketIO.h"
#include <iostream>
namespace task {
    int XiaoxiMessage::clientAction(socketinf serverinf, const char * arg, size_t len) {
        // Auto generate
        SocketIO sio(serverinf);

        // IMPORTANT trigger master execute serverAction 
        sio.socketWriter->sendFrame(TaskFlag::xiaoximessage, len);
        sio.socketWriter->write(arg, len);


        return AUTO_CLOSE;
    }
    int XiaoxiMessage::serverAction(socketinf clientinf, unsigned long long dataLength) {
        // Auto generate
        SocketIO sio(clientinf);
        sio.socketReader->resetPayloadLen(dataLength);
        char buf[1024] = {0};
        sio.socketReader->read(buf, dataLength);
        std::cout << "来自客户端：" << buf << std::endl;
        return AUTO_CLOSE;
    }
}
